﻿namespace DimensionsHelper.LanguageService.Syntax;

public abstract class SignatureWithParameters(
    SyntaxKinds kind,
    SyntaxToken declareKeywordToken,
    Identifier name,
    SyntaxNode? parent)
    : DeclarationWithParameters<ParameterSignature>(kind, declareKeywordToken, name, parent), IBindableSignature
{
    private TypeBinding _binding = TypeBinding.Void;


    public override bool IsSignature => true;

    /// <summary>
    ///     返回值类型绑定
    /// </summary>
    public TypeBinding Binding => _binding;


    public void Update(TypeBinding binding)
    {
        SetChildField(ref _binding, TypeBinding.IsVoid, binding);
    }


    public override void AcceptVisitor<T>(SyntaxNodeVisitor<T> visitor)
    {
        Accept(visitor, DeclareKeywordToken, NameIdentifier);
        base.AcceptVisitor(visitor);
    }
}